#include<iostream>
#include<stack>
#include<cstdio>
using namespace std;
int a[10005][2];
int n;
int main(){
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	cin>>n;
	int x;
	for(int i=1;i<=n;i++){
		scanf("%s",&a[i][0]);
	}
	int s;
	int n1=n,sum=0;
	bool flag;
	for(int i=1;i<=n1;i++){
		if(a[i][0]!=s&&!a[i][1]){
			printf("%d ",i);
			s=a[i][0];
			a[i][1]=1;
			sum++;
		}
		if(sum==n) break;
		if(i==n1){
			printf("\n");
			s=!s;
			for(int j=1;j<=n;j++){
				if(a[j][1]!=1) flag=1;
			}
			if(flag) i=1;
			else break;
		}
	}
	return 0;
	fclose(stdin);
	fclose(stdout);
}

